<template>
  <span>{{ label }}</span>
</template>

<script setup>
const props = defineProps({
  dataList: Array,
  value: "", //数据真实的值
  valueKey: {
    type: String,
    default: "code",
  },
  labelKey: {
    type: String,
    default: "name",
  },
});
const label = computed(() => {
  if (!props.dataList.length||!props.value) {
    return "";
  }
  let current = props.dataList.filter((item) => {
    return item[props.valueKey] == props.value;
  });
  return current[0][props.labelKey];
});
</script>

<style scoped lang="scss"></style>
